
package com.dyzx.hbb.security.model;

import cn.hutool.core.bean.BeanUtil;
import com.dyzx.hbb.modules.sys.entity.SysUser;
import lombok.Data;

import java.util.List;

@Data

public class LoginUserInfo  {




    private SysUserInfo user;

    private Long shopId;

    private Long deptId;
    private Long organId;

    private String dataScope;

    private List<String> permissions;
    public boolean isAdmin() {
        return user != null && this.getOrganId() != null && this.getOrganId() == 1;
    }



    public LoginUserInfo(SysUser user, List<String> permissions, String dataScope) {
        SysUserInfo sysUserInfo = new SysUserInfo();
        BeanUtil.copyProperties(user, sysUserInfo);
        this.user = sysUserInfo;
        this.deptId = user.getDeptId();
        this.organId = user.getOrganId();
        this.dataScope = dataScope;
        this.permissions = permissions;


    }
}